<template>
  <rj-modal
    :title="$t('groupOperate.hdltitle')"
    :visible="true"
    :maskClosable="false"
    @ok="handleOk"
    width="600px"
    @cancel="handleCancel"
  >
    <Turnover ref="turnoverNet" :groupInfo="groupInfo" />
  </rj-modal>
</template>

<script>
import { RjModal } from '@components';
import Turnover from '../../turnoverNet/index.vue';
import { mapState } from 'vuex';
export default {
  name: 'HandoverGroup',
  props: {
    groupInfo: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  components: {
    'rj-modal': RjModal,
    Turnover,
  },
  computed: {
    ...mapState('Group', ['grouproot']),
  },
  mounted() {},
  watch: {},
  methods: {
    async handleOk() {
      const { success } = await this.$refs.turnoverNet.sendTurnover();
      if (success) {
        this.$message.success(this.$t('groupOperate.change'));
        const { groupId } = this.grouproot;
        groupId && this.$store.commit('Group/SET_GROUPID', groupId); // 存在网络，更新选择Group
        this.$emit('closeCallback', { success: true });
      }
    },
    handleCancel() {
      this.$emit('closeCallback');
    },
  },
};
</script>

<style lang="less" scoped></style>
